<?php
session_start();
require_once 'header.php';
function __autoload($className)
	{
    	require_once('class/' . $className . '.class.php');
	}
session::need_member();
$UserId=session::getuserid();
$Ticketid=intval($_GET["ticketid"]);
session::need_isset($Ticketid, "viewtickets.php");
if(session::is_manager()==TRUE)
{
	$CheckPermission=1;
	$UserId=intval($_GET["userid"]);
}
else 
{
	$CheckPermission=user::checkpermission('tickets', "userid = $UserId", "ticketid=$Ticketid");
	
}
if(($CheckPermission==1))
{
	$GetTicketSoure=database::LimitQuery('tickets',array(
	'select' => 'userpost,contents,date,closed',
	'condition' => array(
	'userid' => $UserId,
	'ticketid' => $Ticketid,
	),
	'order' => 'order by replyid asc'
	));
	require_once 'html/ticketsdetail.php';
}
?>